package com.dg11185.nearshop.net.request;

import com.dg11185.libs.network.http.client.HttpRequest;
import com.dg11185.libs.utils.MD5.MD5Utils;
import com.dg11185.nearshop.app.Constants;
import com.dg11185.nearshop.net.response.SendCommentMerchantResponse;

public class SendCommentMerchantRequest extends HttpRequest<SendCommentMerchantResponse>{

    public SendCommentMerchantRequest(String merchantId, String content, String userId, String userName) {
        super(Constants.ADDRESS, Constants.commentMerchant);
        addParam("merchantId", merchantId);
        addParam("content", content);
        addParam("userId", userId);
        addParam("userName", userName);
        addParam("chshToken", Constants.TOKEN);
    }

    /**
     * <可选参数>
     * <param name="title">标题</param>
     * <param name="starRating">星级评分</param>
     * <param name="tasteEvaluation">口味评分</param>
     * <param name="environmentalAssessment">环境评分</param>
     * <param name="serviceEvaluation">服务评分</param>
     * </可选参数>
     */
    public SendCommentMerchantRequest add(String key, String value){
        addParam(key, value);
        return this;
    }
    
    public SendCommentMerchantRequest encryption(){
        addParam("chshSign", MD5Utils.getMD5Str(getParams(), Constants.MD5_key));
        return this;
    }
    
    @Override
    protected SendCommentMerchantResponse parseJson(String response) throws Exception {

        SendCommentMerchantResponse r = new SendCommentMerchantResponse();
        r.parseJson(response);
        return r;
    }

}
